using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace PlanetWPF.Toolbelt.Controls
{
    /// <summary>
    /// </summary>
    public class PowerGridView : Control
    {
        static PowerGridView()
        {
            //This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
            //This style is defined in themes\generic.xaml
            DefaultStyleKeyProperty.OverrideMetadata(typeof(PowerGridView), new FrameworkPropertyMetadata(typeof(PowerGridView)));
            ItemsProperty = DependencyProperty.Register("Items", typeof(IEnumerable), typeof(PowerGridView), new FrameworkPropertyMetadata(null, ItemsChanged));
            ColumnsProperty = DependencyProperty.Register("Columns", typeof(PowerGridColumnCollection), typeof(PowerGridView), new FrameworkPropertyMetadata(null, ColumnsChanged));
            ParentGridProperty = DependencyProperty.Register("ParentGrid", typeof(PowerGrid), typeof(PowerGridView), new UIPropertyMetadata(null));

        }
        public static readonly DependencyProperty ParentGridProperty;
        public static readonly DependencyProperty ItemsProperty;
        public static readonly DependencyProperty ColumnsProperty;

        public IEnumerable Items
        {
            get { return (IEnumerable)GetValue(ItemsProperty); }
            set { SetValue(ItemsProperty, value); }
        }

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            ParentGrid = TemplatedParent as PowerGrid;
        }

        public PowerGrid ParentGrid
        {
            get { return (PowerGrid)GetValue(ParentGridProperty); }
            set { SetValue(ParentGridProperty, value); }
        }

        private static void ItemsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //TODO: Implement this handler.
        }

        public PowerGridColumnCollection Columns
        {
            get { return (PowerGridColumnCollection)GetValue(ColumnsProperty); }
            set { SetValue(ColumnsProperty, value); }
        }

        private static void ColumnsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //TODO: Implement this handler.
        }

    }
}
